<template>
  <load v-if="this.$store.state.isLoad"></load>
  <div class="riman" v-else-if="!this.$store.state.isLoad">
    <div
      class="list"
      v-for="(item, index) in listData"
      :key="index"
      @click="goDetail(item.comic_id)"
    >
      <div class="imgbox">
        <img :src="'https://images.weserv.nl/?url=' + item.vertical_cover" />
      </div>
      <div class="content">
        <div class="title">{{ item.title }}</div>
        <div class="text">
          <div class="author">
            <span v-for="(itemAuthor, index) in item.author" :key="index">{{
              itemAuthor
            }}</span>
          </div>
          <div
            class="label"
            v-for="(itemStyles, index) in item.styles"
            :key="index"
          >
            {{ itemStyles.name }}
          </div>
          <div class="update">
            更新至<span>{{ item.last_short_title }}话</span>
          </div>
        </div>
      </div>
      <!-- <div class="icon"></div> -->
    </div>
  </div>
</template>

<script>
import load from "../components/Load.vue";
export default {
  name: "Riman",
  components: {
    load,
  },
  data() {
    return {
      listData: [],
    };
  },
  created() {
    this.getList(3);
    // console.log(this.$store.state.isLoad);
  },
  methods: {
    getList(type) {
      this.axios({
        method: "get",
        url: "/HomeHot",
        params: {
          type: type,
        },
      })
        .then((res) => {
          //   console.log("res ==>", res);
          this.listData = res.data.data;
          // console.log(this.$isLoad);
          // console.log("this.listData ==> ", this.listData);
        })
        .catch((err) => {
          // console.log("err ==>", err);
        });
    },
    goDetail(id) {
      this.$router.push({
        name: "Detail",
        query: {
          id: id,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.riman {
  margin-top: 10px;
  .list {
    width: 100%;
    height: 139px;
    // border: 1px solid black;
    margin-top: 15px;
    display: flex;
    position: relative;
    .imgbox {
      width: 102px;
      height: 136px;
      margin-left: 40px;
      img {
        width: 100%;
      }
    }
    .content {
      width: 191px;
      height: 136px;
      //   background: blue;
      margin-left: 8px;
      .title {
        font-size: 18px;
        color: #1c1d1f;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
      .text {
        position: absolute;
        bottom: 0;
        .author {
          font-size: 12px;
          color: #90959b;
          //   margin-top: 50px;
          span {
            margin-left: 5px;
          }
          span:nth-child(1) {
            margin-left: 0px;
          }
        }
        .label {
          font-size: 12px;
          color: #90959b;
          margin-top: 7px;
        }
        .update {
          font-size: 12px;
          color: #90959b;
          margin-top: 7px;
        }
      }
    }
  }
  .icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    background: url();
    background-size: cover;
    position: absolute;
    bottom: 0;
    right: 13px;
  }
}
</style>